All Questions
Tagged with linux-kernelsystem-calls
79 questions
0votes
0answers
22views
How to trace recvfrom and sendto syscall each time apache2/httpd handle incoming http request?
So, I decided to start learn about system call with strace and want to observe network-related system call on apache2 processes, here's how I attach it: pidof -s apache2 pstree -sTp <pid-from-pidof&...
0votes
0answers
26views
BPF program attached to `getname` won't get called when calling the `renameat2` syscall
I'm fiddling with a BPF program that needs to attach to the two "getname" functions that are being called from the renameat2 syscall, defined in linux/fs/namei.c as: SYSCALL_DEFINE5(...
1vote
2answers
289views
Is systemd the first process that runs in user mode in linux?
I know that switching from user mode to kernel mode occurs continuously via system calls. My question is if systemd is the exact point during the starting of a linux system where the first ...
2votes
1answer
1kviews
Linux syscalls: advantage of copy_file_range over sendfile?
I understand that classically, the Linux Kernel was conservative about adding new syscalls. But, I've learned about the existence of copy_file_range, which seems to do the exact same thing as sendfile....
4votes
1answer
162views
is stat(2) read-after-write consistent with write(2)?
man 2 write states: POSIX requires that a read(2) that can be proved to occur after a write() has returned will return the new data. Note that not all filesystems are POSIX conforming. In Linux, is ...
3votes
1answer
827views
Man pages, syscalls, and libc
Why is epoll_create not listed as a library function (man pages, section 3), but accept is? While both functions are provided by libc and both refers to kernel syscalls? I know that "why" ...
0votes
1answer
2kviews
Get executable name in syscall?
So I am writing a system call in Linux. I want to print a message that looks like printk(KERN_DEBUG "PROC_DEBUG [%s, %s]: %s", executable, current->pid, message); Where executable is the ...
8votes
5answers
3kviews
What is difference between sleep and NOP in depth?
I am trying to learn operating system concepts. Here is two simple python code: while True: pass and this one: from time import sleep while True: sleep(0.00000001) Question: Why when running ...
1vote
1answer
443views
Why is the linux system call interface architecture-dependent?
So one thing I'm not clear on is why transitioning from user space to kernel space is architecture-dependent. For example, the linux kernel v5.4 code for system calls entering kernel space is ...
1vote
1answer
707views
Retrieve the virtual page id from a virtual address
We know this following function from Linux kernel, which takes a pointer to the struct page and outputs the virtual address of the page frame: void * page_address(struct page *page) So I wonder if a ...
0votes
0answers
446views
How to track open() syscalls in FUSE filesystem?
I want to track all open() syscalls of a process inside a FUSE filesystem. Two concerns: Is there any usecase, when open() syscall will not trigger a FUSE filesystem operation? For example syscall ...
2votes
2answers
907views
Linux Page Cache Performance versus memcpy
I am benchmarking the write performance in the case that Linux writes the data to the page cache without throttling the process or syncing the data to the disk. The simple experiment I am doing looks ...
2votes
1answer
258views
Why fcntl() range lock (some offset to length) is slower as compared to fcntl full file lock (0 offset to EOF)? [closed]
I am trying to write on 1 GB file from 8 different processes (every process will start writing from 0th offset till EOF) simultaneously; while following two different approaches. Before writing every ...
5votes
1answer
888views
Difference between posix_fadvise and readahead
As per manpage, readahead is Linux specific: CONFORMING TO The readahead() system call is Linux-specific, and its use should be avoided in portable applications. and posix_fadvise is portable: ...
1vote
1answer
282views
how to declare a new variable in vvar.h |create a vdso in linux
I am trying to declare a new variable in vvar.h and define it near my new VDSO function. So that I could use this variable in my vdso function. I have a trouble about VVar. According to the ...